meson: Only use HarfBuzz fallback when needed
authorChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 12 Apr 2019 10:08:36 +0000 (18:08 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 12 Apr 2019 10:16:12 +0000 (18:16 +0800)
The current Meson releases have broken CMake support, meaning that it is
likely that HarfBuzz could not be located for Visual Studio builds
unless one handcrafts pkg-config files for it, which is both tedious and
error-prone.

Instead, use the existing mechanism for looking for the HarfBuzz headers
and libraries on Visual Studio first when it could not be found via
dependency(), and then use the fallback if it still could not be found.

meson.build

index 9c2142d16609164d103b60fdde773148e55b8c7b..ab30f90098a7519611ce385fe1c297af416cbd2f 100644 (file)
@@ -376,8 +376,7 @@ pixbuf_dep     = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
 epoxy_dep      = dependency('epoxy', version: epoxy_req,
                             fallback: ['libepoxy', 'libepoxy_dep'])
 atk_dep        = dependency('atk', version: atk_req)
-harfbuzz_dep   = dependency('harfbuzz', version: '>= 0.9', required: false,
-                            fallback: ['harfbuzz', 'libharfbuzz_dep'])
+harfbuzz_dep   = dependency('harfbuzz', version: '>= 0.9', required: false)
 xkbdep         = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled)
 graphene_dep   = dependency('graphene-gobject-1.0', version: graphene_req,
                             fallback: ['graphene', 'graphene_dep'])
@@ -460,6 +459,11 @@ if cc.get_id() == 'msvc'
   endif
 endif
 
+if not harfbuzz_dep.found()
+  harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false,
+                            fallback: ['harfbuzz', 'libharfbuzz_dep'])
+endif
+
 cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found())
 cdata.set('HAVE_PANGOFT', pangoft_dep.found())